package com.example.demo.bean;

import com.example.demo.util.IntegerToStringUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserRecord {
    private Integer id;
    private String username;
    private String name;
    private String idtype;
    private String idnumber;
    private String type;
    private String campus;
    private String address;
    private String telnumber;
    private String emcontact;
    private String emctelnumber;
    private String health;
    private String reportstatus;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date time;
    private String arrival;
    private String contactper;
    private String contactsick;
    private String quarantine;
    private String atguan;
    private String streettown;
    private String returnguan;
    private String leaveguan;
    private String keygroups;
    private String situation;
    private String remarks;
    private Double temperature;

    public UserRecord( UserInfo userInfo, ERecord eRecord){
        this( ) ;
        this.setId(userInfo.getId());
        this.setUsername(userInfo.getUsername());
        this.setName(userInfo.getName());
        this.setIdtype(IntegerToStringUtil.changerIdtype(userInfo.getIdtype()));
        this.setIdnumber(userInfo.getIdnumber());
        this.setType(userInfo.getType());
        this.setCampus(userInfo.getCampus());
        this.setAddress(userInfo.getAddress());
        this.setTelnumber(userInfo.getTelnumber());
        this.setEmcontact(userInfo.getEmcontact());
        this.setEmctelnumber(userInfo.getEmctelnumber());
        this.setHealth(IntegerToStringUtil.changerHealth(userInfo.getHealth()));

        this.setTime(eRecord.getTime());
        this.setStreettown(eRecord.getStreettown());
        this.setRemarks(eRecord.getRemarks());
        this.setTemperature(eRecord.getTemperature());
        this.setArrival(IntegerToStringUtil.changerArival(eRecord.getArrival()));
        this.setContactper(IntegerToStringUtil.changerContactper(eRecord.getContactper()));
        this.setContactsick(IntegerToStringUtil.changerContactsick(eRecord.getContactsick()));
        this.setQuarantine(IntegerToStringUtil.changerQuarantine(eRecord.getQuarantine()));
        this.setAtguan(IntegerToStringUtil.changerAtguan(eRecord.getAtguan()));
        this.setReturnguan(IntegerToStringUtil.changerReturnguan(eRecord.getReturnguan()));
        this.setLeaveguan(IntegerToStringUtil.changerLeaveguan(eRecord.getLeaveguan()));
        this.setKeygroups(IntegerToStringUtil.changerKeygroups(eRecord.getKeygroups()));
        this.setSituation(IntegerToStringUtil.changerSituation(eRecord.getSituation()));
    }
}
